const fs =require('fs')
const path =require('path')
const Mock =require('mockjs')
const JSON5 =require('json5')

function getJsonFile(filePath){
    // 读取指定json文件
    var json = fs.readFileSync(path.resolve(__dirname,filePath),'utf-8')
    console.log('path',path.resolve(__dirname,filePath));
    // 解析并返回文件
    return JSON5.parse(json)
}

module.exports = function(devServer){
    devServer.app.get('/user/operateFormLabel',function(req,res){
        var json = getJsonFile('./operateFormLabel.json5')
        res.json(Mock.mock(json))
    })
}

module.exports = function(devServer){
    devServer.app.get('/user/userinfo',function(req,res){
        var json = getJsonFile('./operateFormLabel.json5')
        res.json(Mock.mock(json))
    })
}

